<html>
<head><meta charset="utf-8"><title>Review my PR · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html">Review my PR</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="229484468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229484468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229484468">(Mar 09 2021 at 14:25)</a>:</h4>
<p>Hi, my PR currently waits for review for two weeks now, I would appreciate if someone did it soon <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span> <br>
<a href="https://github.com/rust-lang/rust/pull/82191">https://github.com/rust-lang/rust/pull/82191</a></p>



<a name="229487827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229487827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229487827">(Mar 09 2021 at 14:46)</a>:</h4>
<p>Thank you for contributing! I took a look through the PR and added some comments.</p>



<a name="229492794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229492794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229492794">(Mar 09 2021 at 15:17)</a>:</h4>
<p>Looks like my comments in code aren't clear enough, should i maybe redo them?</p>



<a name="229493685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229493685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229493685">(Mar 09 2021 at 15:23)</a>:</h4>
<p>Nah, I think they're fine.</p>



<a name="229733884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229733884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229733884">(Mar 10 2021 at 20:07)</a>:</h4>
<p>i have a little problem with benchmarks - they are too inconsistent<br>
sometimes my code is nearly twice as fast, sometimes i lose 50% of performance somewhere<br>
plus i have other idea for this function, which relies more heavily on memmove, which again makes benchmarking less consistent across AMD and Intel platforms</p>



<a name="229734194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229734194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229734194">(Mar 10 2021 at 20:09)</a>:</h4>
<p>in my experience that can happen for a couple of reasons, a noisy benchmarking environment &amp; extremely light benchmarked code being two.</p>



<a name="229734230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229734230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229734230">(Mar 10 2021 at 20:09)</a>:</h4>
<p>so for instance for dedup_by, I would look at running this code on vectors of 10k or 100k elements or similar.</p>



<a name="229734453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229734453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229734453">(Mar 10 2021 at 20:10)</a>:</h4>
<p>once the benchmarks get into a millisecond-per-iteration range, the noise gets amortized somewhat.</p>



<a name="229735054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229735054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229735054">(Mar 10 2021 at 20:13)</a>:</h4>
<p>i did like 1000 iterations for 100k elements and had very different results than with 100 iters and 1m elements<br>
Also somehow using i16 instead of u16 also was changing the results</p>



<a name="229736181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229736181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229736181">(Mar 10 2021 at 20:19)</a>:</h4>
<p>For today, I'm kinda tired<br>
Probably tommorow I'm gonna write a better benchmarker, because now it's singlethreaded and not really optimized</p>



<a name="229740150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229740150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229740150">(Mar 10 2021 at 20:40)</a>:</h4>
<p>Should just use <code>#[bench]</code> I think. If that doesn't give great results… then oh well.</p>



<a name="229908173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229908173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229908173">(Mar 11 2021 at 19:12)</a>:</h4>
<p>You should monitor your CPU frequencies when benchmarking. If they vary a lot then disabling turbo can return more consistent results</p>



<a name="229908782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229908782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229908782">(Mar 11 2021 at 19:16)</a>:</h4>
<p>Looking at the assembly output of individual benchmarks can help too. E.g. it helps spotting cases where it optimizes away too much and you need to add black_box.</p>



<a name="229926707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229926707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229926707">(Mar 11 2021 at 21:12)</a>:</h4>
<p>Besides <code>Instant::elapsed</code> i also use rdtsc to measure cpu cycles</p>



<a name="229927148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/229927148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#229927148">(Mar 11 2021 at 21:15)</a>:</h4>
<p>for now i need something to make nice graphs :D</p>



<a name="230416903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/230416903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Soveu <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#230416903">(Mar 15 2021 at 20:56)</a>:</h4>
<p>Ok, finally I'm done with it</p>



<a name="230424330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Review%20my%20PR/near/230424330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Review.20my.20PR.html#230424330">(Mar 15 2021 at 21:52)</a>:</h4>
<p>rdtsc counts reference clocks, not instructions. And Instant already boils down to rdtsc (+ some simple arithmetic) on some platforms. If you want to count instructions and you're on linux you can use <code>perf stat</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>